home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Vertigo / Nub / Patches.c < prev    next >
Text File  |  2000-06-23  |  3KB  |  148 lines

  1. #define DISABLE_LOCAL_CALLTRACE        1        // Set to 1 to disable Call Traces for this file.
  2. #define DISABLE_LOCAL_DEBUG            0        // Set to 1 to disable all debugging for this file.
  3. #include "DebugUtils.h"
  4.  
  5. #include <LowMem.h>
  6. #include "ContextUtils.h"
  7. #include "Nub.h"
  8. #include "Patches.h"
  9. #include "PatchHarness.h"
  10. #include "Port.h"
  11. #include "ProcInfo.h"
  12.  
  13. #include "FlushPort.h"
  14.  
  15.  
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. static pascal void CleanUpApplicationPatch(void);
  22. static pascal void CloseCPortPatch(CGrafPtr port);
  23. static pascal void ClosePortPatch(GrafPtr port);
  24. static pascal void CopyBitsPatch(BitMap *srcBits,BitMap *dstBits,Rect *srcRect,Rect *dstRect,short mode,RgnHandle maskRgn,CopyBitsProcPtr copyBitsProc);
  25. static pascal void OpenCPortPatch(CGrafPtr port);
  26. static pascal void OpenPortPatch(GrafPtr port);
  27. static pascal void SynchIdleTimePatch(void);
  28.  
  29. #ifdef __cplusplus
  30. }
  31. #endif
  32.  
  33.  
  34.  
  35.  
  36.  
  37. extern NubInfo                        *gInfo;
  38. static RoutineDescriptor            gCleanUpApplicationPatchRD = BUILD_ROUTINE_DESCRIPTOR(uppCleanUpApplicationPatchProcInfo,CleanUpApplicationPatch);
  39. static RoutineDescriptor            gCloseCPortPatchRD = BUILD_ROUTINE_DESCRIPTOR(uppCloseCPortPatchProcInfo,CloseCPortPatch);
  40. static RoutineDescriptor            gClosePortPatchRD = BUILD_ROUTINE_DESCRIPTOR(uppClosePortPatchProcInfo,ClosePortPatch);
  41. static RoutineDescriptor            gCopyBitsPatchRD = BUILD_ROUTINE_DESCRIPTOR(uppCopyBitsPatchProcInfo,CopyBitsPatch);
  42. static RoutineDescriptor            gOpenCPortPatchRD = BUILD_ROUTINE_DESCRIPTOR(uppOpenCPortPatchProcInfo,OpenCPortPatch);
  43. static RoutineDescriptor            gOpenPortPatchRD = BUILD_ROUTINE_DESCRIPTOR(uppOpenPortPatchProcInfo,OpenPortPatch);
  44. static RoutineDescriptor            gSynchIdleTimePatchRD = BUILD_ROUTINE_DESCRIPTOR(uppSynchIdleTimePatchProcInfo,SynchIdleTimePatch);
  45.  
  46.  
  47. extern Boolean                        gOkToBlit = false;
  48. extern GWorldPtr                    gScreenBuffer;
  49.  
  50.  
  51.  
  52. void InitializePatches(void)
  53. {
  54.     InstallPatch(gInfo->patchList,'CApp',&gCleanUpApplicationPatchRD);
  55.     InstallPatch(gInfo->patchList,'ClCP',&gCloseCPortPatchRD);
  56.     InstallPatch(gInfo->patchList,'CloP',&gClosePortPatchRD);
  57.     InstallPatch(gInfo->patchList,'CBit',&gCopyBitsPatchRD);
  58.     InstallPatch(gInfo->patchList,'OpCP',&gOpenCPortPatchRD);
  59.     InstallPatch(gInfo->patchList,'OpnP',&gOpenPortPatchRD);
  60.     InstallPatch(gInfo->patchList,'IDLE',&gSynchIdleTimePatchRD);
  61. }
  62.  
  63.  
  64.  
  65.  
  66.  
  67. void FinalizePatches(void)
  68. {
  69.     RemovePatch(gInfo->patchList,'IDLE');
  70.     RemovePatch(gInfo->patchList,'OpnP');
  71.     RemovePatch(gInfo->patchList,'OpCP');
  72.     RemovePatch(gInfo->patchList,'CBit');
  73.     RemovePatch(gInfo->patchList,'CloP');
  74.     RemovePatch(gInfo->patchList,'ClCP');
  75.     RemovePatch(gInfo->patchList,'CApp');
  76. }
  77.  
  78.  
  79. #if 0
  80. #pragma mark -
  81. #endif
  82.  
  83.  
  84. pascal void CleanUpApplicationPatch(void)
  85. {
  86.     StSystemZone zone;
  87.     RescanPorts();
  88. }
  89.  
  90.  
  91.  
  92.  
  93.  
  94. pascal void CloseCPortPatch(CGrafPtr port)
  95. {
  96.     StSystemZone zone;
  97.     UnregisterPort((GrafPtr)port,false);
  98. }
  99.  
  100.  
  101.  
  102.  
  103.  
  104. pascal void ClosePortPatch(GrafPtr port)
  105. {
  106.     StSystemZone zone;
  107.     UnregisterPort(port,false);
  108. }
  109.  
  110.  
  111.  
  112.  
  113.  
  114. pascal void CopyBitsPatch(BitMap *srcBits,BitMap *dstBits,Rect *srcRect,Rect *dstRect,short mode,RgnHandle maskRgn,CopyBitsProcPtr copyBitsProc)
  115. {
  116.     MungeCopyBits(srcBits,dstBits,srcRect,dstRect,mode,maskRgn,copyBitsProc);
  117. }
  118.  
  119.  
  120.  
  121.  
  122.  
  123. pascal void OpenCPortPatch(CGrafPtr port)
  124. {
  125.     StSystemZone zone;
  126.     RegisterPort((GrafPtr)port);
  127. }
  128.  
  129.  
  130.  
  131.  
  132.  
  133. pascal void OpenPortPatch(GrafPtr port)
  134. {
  135.     StSystemZone zone;
  136.     RegisterPort(port);
  137. }
  138.  
  139.  
  140.  
  141.  
  142.  
  143. pascal void SynchIdleTimePatch(void)
  144. {
  145.     StSystemZone zone;
  146.     FlushScreenBuffer();
  147. }
  148.